package com.km.mapper;

import com.km.entity.City;
import org.apache.ibatis.annotations.*;

import java.util.List;

/**
 * <p></p>
 * Created by zhezhiyong@163.com on 2017/9/1.
 */
public interface CityMapper {

    @Select("select * from city")
    List<City> getAll();

    @Insert("insert into city(name,state) values(#{name},#{state})")
    //设置id自增长
    @Options(useGeneratedKeys = true, keyColumn = "id", keyProperty = "id")
    int insert(City city);

    @Update("update city set state = #{state} where name = #{name}")
    int update(City city);

    @Delete("delete from city where name = #{name}")
    int delete(City city);

}
